<link rel="stylesheet" type="text/css" href="/simpletree/js/tree_themes/SimpleTree.css"/>
<script type="text/javascript" src="/simpletree/js/SimpleTree.js"></script>
<script type="text/javascript">
$(function(){
	$(".st_tree").SimpleTree({
		click:function(a){
			if(!$(a).attr("hasChild"))
				alert($(a).attr("ref"));
		}
	});
});
</script>

<style type="text/css">
.from{float:left;clear:both;margin-bottom:10px;}
.from1{float:left; margin-left:20px; margin-top:0px; padding-right:15px; clear:both; max-width:300px;}
.to{float:right;clear:both;margin-bottom:10px;}
.to1{float:right; margin-right:20px; margin-top:0px; padding-right:15px; clear:both; max-width:300px;}
</style>


<div class="container-fluid">
	<div class="row-fluid">
		<div class="span2">
			   <ul class="nav nav-tabs nav-stacked">
				<li ><a href="/letter/index">未处理消息</a></li>
				<li><a href="/letter/send">发送消息</a></li>
				<!--<li><a href="/letter/recycle">回收站</a></li>-->
				<li class="active"><a href="/letter/history">历史消息</a></li>
            </ul>					   
		</div>
	<div class="span10">
      <fieldset><legend>历史消息</legend>	 
          <form action="/<*$controller*>/<*$action*>" method="get" class="form-horizontal">       
            <select name="group_id" id="group_id" style=" float:left;width:200px;z-index:200;"> 
                <option value="">---选择机构---</option> 
                <*foreach from =$result item=item key=key*>
                <option value="<*$item.groupid*>" <*if $group_id==$item.groupid*> selected<*/if*>><*$item.groupname*></option> 
                <*/foreach*>
            </select>
            &nbsp;
            <input  type="text" name="content" class="span3"  placeholder="请输入要查询的内容" value="<*$content*>" /> 
            <input type="submit" class="btn btn-success"  value="查询"  >
             <input type="button" class="btn" value="重新查询" onclick="window.location='/<*$controller*>/<*$action*>'" >
          </form>
	  	  <br />	
          
          <*if $str*>
          <div id='list' class="span9"><*$str*></div>
                <div style="clear:both">
                <div class="tabbable"> 
                <form action='/letter/reply/' method='post' enctype="multipart/form-data">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab1" data-toggle="tab" onclick='cleartab(1)'>文字</a></li>
                        <li><a href="#tab2" data-toggle="tab" onclick='cleartab(2)'>图片</a></li>
                    </ul>
                    <div class="tab-content">
                            <div class="tab-pane active" id="tab1">
                               <textarea id="content" name="content" style="width:645px;height:200px;"></textarea>
                            </div>
                            <div class="tab-pane" id="tab2">
                              <input type='file' name='pic' id='pic'>
                            </div>
                            <div>
                            <input type='hidden' name='lid' value='<*$lid*>'>
                            <input type='hidden' name='tid' value='<*$tid*>'>
                            <input type='hidden' name='classid' value='<*$classid*>'>
                            <input type='hidden' name='history' value='1'>
                               <input type='submit' id='tj' value='提交'>
                            </div>						
                    </div>
                </form>
                </div>
                </div>
          
	 	  <*elseif $data *>
                <table class="table table-hover">
                	<tr><th>校区</th><th>内容</th><th>时间</th></tr>
                    <*foreach from=$data item=item key=key*>
                    <tr style="cursor:pointer" onclick="window.location='/letter/history/group_id/<*$group_id*>/letterid/<*$item.letterid*>/content/<*$item.content*>'">
                        <td><*$item.uname*>&nbsp;<*if $item.detail*><span style="color:gray"><*$item.detail*></span><*else*>运营<*/if*></td><td title="<*$item.content*>"><*if $item.content*><*$item.content|smartTruncate:15:'……'*><*else*><span style="color:red">[图片]</span><*/if*></td><td><*$item.addtime*></td>
                           </tr>
                    <*/foreach*>
                </table>
			<*elseif $teacher*>
          
                <table class="table table-hover">
                    <*eval var=-1 assign="groupid_or"*>
                         <*foreach from=$teacher item=rs*>
                    <*eval var=$rs.groupid assign="groupid"*>
                    <*if $groupid_or<>$groupid*>
                     <tr class="success">
                     <td colspan="4"><*eval var=$rs.groupid assign="groupid"*><*if $groupid*><*$rs.groupname*><*else*>默认<*/if*></td>
                     </tr>
                     <tr><th>校区</th><th>内容</th><th>时间</th></tr>
                    <*eval var=$groupid assign="groupid_or"*>
                    <*/if*>
                           <tr style="cursor:pointer" onclick="window.location='/letter/history/letterid/<*$rs.lid*>/group_id/<*$groupid*>/content/<*$rs.content*>'">
                               <td><*$rs.teachername*>&nbsp;<*$rs.classname*>&nbsp;<small style="color:gray"><*$rs.schoolname*></small></td><td><*if $rs.content*><*$rs.content*><*else*><span style="color:red">[图片]</span><*/if*></td><td><*$rs.addtime*></td>
                           </tr>
                         <*/foreach*>
                  </table>
             <*else*>
                  没有信息！
           <*/if*>
           
     </fieldset>
	</div>
<!--	<div class="span3">	
		<div class="st_tree">		
			<ul>
			     <li>班级列表</li>
				 <*foreach from=$result item=rs*>
				 <li><a onclick='getsch("<*$rs.groupid*>")'><*$rs.groupname*></a></li>
                  <ul id='two_<*$rs.groupid*>'></ul>
				 <*/foreach*>			     
			</ul>
			</div>
		</div>
-->	</div>
</div>
   





<script>

function getsch(gid){
    $.get("/letter/getsch/groupid/"+gid,
	function(data){
	  $('#two_'+gid).empty();
	  $('#two_'+gid).append(data);
	});
}
function getcla(ids){ 
   var obj = eval('('+'ids'+')');
   $('.three').hide();
   $('#three_'+obj.sid).show(); 
   var obj = eval('('+'ids'+')');
   $('#sch'+obj.sid+'>ul').empty();
   $.get("/letter/getcla/gid/"+obj.gid+"/sid/"+obj.sid,
   function(data){
       $('#three_'+obj.sid).empty();
	  $('#three_'+obj.sid).append(data);
   });   
  
}
function getList(cid){
  $.get("/letter/getlist/cid/"+cid,
  function(data){
	 $('#list').empty().append(data);
  });
  $('.tabbable').show();
}
function cleartab(id){
  if(id==1){
    $('#content').val('');
  }else{
    $('#pic').val('');
  }
}
</script>
